cmake_minimum_required(VERSION 3.16)
project(WaylandWindowThumbnail)

set(KF5_MIN_VERSION "5.68.0")
set(QT_MAJOR_VERSION 5)

set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)

find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(KDEClangFormat)
include(KDEGitCommitHooks)
include(ECMQtDeclareLoggingCategory)

find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Core DBus Quick Gui Qml WaylandClient)
find_package(KF5 REQUIRED COMPONENTS Wayland I18n CoreAddons)
find_package(Wayland REQUIRED COMPONENTS Client)

pkg_check_modules(PipeWire IMPORTED_TARGET libpipewire-0.3 REQUIRED)
pkg_check_modules(GBM IMPORTED_TARGET gbm)

find_package(epoxy 1.3 REQUIRED)
find_package(Libdrm 2.4.62)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# add clang-format target for all our real source files
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)

# Prevent EGL headers from including platform headers, in particular Xlib.h.
add_definitions(-DMESA_EGL_NO_X11_HEADERS)
add_definitions(-DEGL_NO_X11)
add_definitions(-DEGL_NO_PLATFORM_SPECIFIC_TYPES)

add_subdirectory(src)
ki18n_install(po)
